package com.cdh.oa.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cdh.oa.entity.User;
import com.cdh.oa.entity.vo.UserRoleDeptJobVo;
import com.cdh.oa.mapper.UserMapper;
import com.cdh.oa.service.IUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cdh.oa.util.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author CDHong
 * @since 2018-11-22
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public ResponseData userPage(Integer pageIndex, Integer pageSize, String search) {
        Page<UserRoleDeptJobVo> page = new Page<>(pageIndex,pageSize);
        List<UserRoleDeptJobVo> list = userMapper.userPage(page, search);
        return ResponseData.okPage(page.getTotal(),list);
    }
}
